package com.zha.factory;

import com.zha.strategy.LoginStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @Title: 只有光头才能变强
 * @Author: 炸炸
 * @Date: 2024/12/7 19:29
 * 登录策略工厂类
 */
@Component
public class LoginStrategyFactory {

    @Autowired
    private Map<String, LoginStrategy> loginStrategyMap = new HashMap<>();

    /**
     * 根据登录类型获取具体的登录策略
     * @param loginType  登录类型
     * @return  登录策略
     */
    public LoginStrategy getInstance(String loginType) {
        return loginStrategyMap.get(loginType);
    }
}
